<div>
    <hr>
    <ul class="breadcrumb">
        <li>
            <a href="#">标签</a> <span class="divider">|</span>
        </li>
        <li>
            <a href="#">列表</a>
        </li>
    </ul>
    <hr>
</div>
<div class="row-fluid sortable">		
    <div class="box span12">
        <div class="box-header" data-original-title>
            <h2>
				<i class="icon-align-justify"></i>
				<span class="break"></span>
			</h2>
            <div class="box-icon">
                <a href="#" class="btn-setting"><i class="icon-wrench"></i></a>
                <a href="#" class="btn-minimize"><i class="icon-chevron-up"></i></a>
                <a href="#" class="btn-close"><i class="icon-remove"></i></a>
            </div>
        </div>
        <div class="box-content">
             <div class="dataTables_length">
                <select class="app" name="checkbox">
                    <option value="1">删除</option>
                </select>
                <a class="exec" href="javascript:void(0);">应用</a>
            </div>
            <table class="table table-striped table-bordered bootstrap-datatable datatable">
                <thead>
                    <tr>
                        <th> <input id="checkbox" type="checkbox" class="checkbox"  /> </th>
                        <th>标签</th>
                        <th>是否置顶</th>
                    </tr>
                </thead>   
                <tbody>
                <?php foreach ($keywords as $item): ?>
					<tr >
						<td>
							<input class="checkbox" type="checkbox" name='id' value="<?php echo $item['id']; ?>" />
						</td>
                        <td class="center"><?php echo $item['name']; ?>&nbsp;</td>
                        <td class="center">
							<a id="<?php echo $item['id']; ?>" class="top" href="javascript:void(0);"><?php echo $item['isTop'] ? '取消顶部' : '顶部'; ?></a>
						</td>
                    </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    </div><!--/span-->
</div><!--/row-->

<script type="text/javascript">
    $(document).ready(function(){
		$(".top").click(function(){
			that = $(this);
			$.post("<?php echo url('keyword/top'); ?>",{id:that.attr('id')},function(data){
				if(data.s==1){
					var str = data.i?'取消顶部':'顶部';
					that.html(str);
				}else{
					$(this).wBox({title:'提示信息',html:data.i}).showBox();
				}
			});
			return false;
		});
        $(".exec").click(function(){
            var app = $(this).prev().val();
            if(app==1){
                var ids = '';
                //获取ID
                $("input[name='id']:checked").each(function(){
                    ids += $(this).val() + ',';
                });
                if(ids.length > 0 ){
                    $.post("<?php echo url('links/del'); ?>",{'id':ids},function(data){
                        $("input[name='id']:checked").parents('tr').remove();
                    });			
                }else{
                    $(this).wBox({html:'错误'}).showBox();
                }
            }else{
            
            }
        });
    });
</script>
